﻿#ifndef PROJECTTREEDATAMANAGER_H
#define PROJECTTREEDATAMANAGER_H

#include <QString>
#include <QObject>
#include <QList>
#include <QHash>
#include <QPair>
#include <QMap>
#include <QStack>
#include "API_DataManager.h"
#include "BaseModule/GlobalEnums.h"

namespace DataManager
{
    class API_DATAMANAGER ProjectTreeDataManager : public QObject
    {
        Q_OBJECT
        Q_PROPERTY(QString m_simulationDataFilePaths READ getSimulationDataFilePaths WRITE setSimulationDataFilePaths)
        Q_PROPERTY(QList<int> m_itemParentIDList READ getItemParentIDList WRITE setItemParentIDList)
        Q_PROPERTY(QList<int> m_itemOwnIDList READ getItemOwnIDList WRITE setItemOwnIDList)
        Q_PROPERTY(QList<QString> m_itemNameList READ getItemNameList WRITE setItemNameList)
        Q_PROPERTY(QString m_paasteAndImportItemData READ getPasteAndImportItemData WRITE setPasteAndImportItemData)
        Q_PROPERTY(QString m_importItemDataStr READ getImportItemDataList WRITE setImportItemDataList)
    public:
        Q_INVOKABLE ProjectTreeDataManager() {}
        ~ProjectTreeDataManager() {}

        QString getSimulationDataFilePaths() { return m_simulationDataFilePaths; }
        void setSimulationDataFilePaths(QString filePath) { m_simulationDataFilePaths = filePath;}

        QList<int> getItemParentIDList() { return m_itemParentIDList; }
        void setItemParentIDList(QList<int> itemParentIDs) { m_itemParentIDList = itemParentIDs; }
        
        QList<int> getItemOwnIDList() { return m_itemOwnIDList; }
        void setItemOwnIDList(QList<int> itemOwnIDs) { m_itemOwnIDList = itemOwnIDs; }
        
        QList<QString> getItemNameList() { return m_itemNameList; }
        void setItemNameList(QList<QString> itemNames) { m_itemNameList = itemNames; }

        QString getPasteAndImportItemData() { return m_pasteAndImportItemData; }
        void setPasteAndImportItemData(QString pasteAndImportItemData) { m_pasteAndImportItemData = pasteAndImportItemData; }

        QString getImportItemDataList() { return m_importItemDataStr; }
        void setImportItemDataList(QString importItemDataList) { m_importItemDataStr = importItemDataList; }

        void clear()
        {
            m_simulationDataFilePaths = "";
            m_itemParentIDList.clear();
            m_itemOwnIDList.clear();
            m_itemNameList.clear();
            m_pasteAndImportItemData.clear();
            m_importItemDataStr.clear();
        }

    private:
        /// @brief 仿真数据文件路径
        QString m_simulationDataFilePaths;
        /// @brief 节点的父节点ID，根节点的父节点ID为-1
        QList<int> m_itemParentIDList;
        /// @brief 节点自己的ID
        QList<int> m_itemOwnIDList;
        /// @brief item的名称
        QList<QString> m_itemNameList;
        /// @brief 复制粘贴节点和导入节点的的数据
        QString m_pasteAndImportItemData;
        /// @brief 导入数据节点的数据
        QString m_importItemDataStr;
    };
} // namespace DataManager
Q_DECLARE_METATYPE(DataManager::ProjectTreeDataManager*)
#endif
